#define  _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
#include<string.h>

int arr[1000000] = { 0 };
int main()
{
    int n = 0, i = 0, temp = 0, max = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%d", &temp);
        if (temp > max)
            max = temp;
        arr[temp]++;
    }
    for (i = 0; i <= max; i++)
    {
        if (arr[i] != 0)
        {
            printf("%d %d\n", i, arr[i]);
        }
    }

    return 0;
}